-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce memory usage of match all bitset #92777
Conversation
Pinging @elastic/es-search (Team:Search) |
Hi @dnhatn, I've created a changelog YAML for you. |
d9625d3
to
42ae1b4
Compare
if (bits == null) { | ||
initializeBitSet(); | ||
} | ||
bits.clear(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need to support clearing bits on this MatchAllBitSet
? It's counter intuitive to me that something called MatchAllBitSet
could have some of its bits not set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I've pushed 0f12598 to make it read-only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me. For the record, I'm in general not a fan of implementing optimizations for cases that should be as rare as this one, but this concern is alleviated by the fact that it shares logic with the same optimization for DLS where I would expect this condition to be less rare.
Thanks, Adrien. I was also hesitant to open this PR, but this class already exists in the security module. |
By default, Elasticsearch uses up to 1 bit per document to store the set of root documents when the index mapping has nested fields. This PR introduces a special BitSet using less memory for match_all filters. This optimization is only triggered when the index mapping has a nested field, but that field never exists in documents.
By default, Elasticsearch uses up to 1 bit per document to store the set of root documents when the index mapping has nested fields. This PR introduces a special BitSet using less memory for match_all filters. This optimization is only triggered when the index mapping has a nested field, but that field never exists in documents.